<?php
    
	function getMaxDbId( $primaryKey, $table)
	{
		$CI =& get_instance();
		
		$getIdQuery = $CI->db->query( 'SELECT MAX(' . $primaryKey . ') as ' . $primaryKey . ' FROM ' . $table );
		eval("\$id = \$getIdQuery->row()->$primaryKey;");
		
		return $id;	
	}

?>